//
//  LZPlayVideoManager.h
//  laziz_Consumer
//
//  Created by xbnzd on 16/12/6.
//  Copyright © 2016年 XBN. All rights reserved.
//

#import <Foundation/Foundation.h>
@class LZCustomPlayerView;

//================
//********播放控制类*********
//===================

@protocol LZPlayVideoManagerDelegate <NSObject>

- (NSString *)playVideoManagerGetVideoUrlWith:(NSIndexPath *)cellIndexPath;
- (UIView *)playVidewManagerGetPlayBackgroundViewWith:(NSIndexPath *)cellIndexPath;
- (NSString *)playVideoManagerGetVideoIdWithIndexPath:(NSIndexPath *)cellIndexPath;

@end

@interface LZPlayVideoManager : NSObject
@property (nonatomic, copy) void(^playCountAddBlock)(NSInteger totleCount);
@property (nonatomic, weak) id<LZPlayVideoManagerDelegate>playVideoManagerDelegate;

+ (instancetype)shareManager;

/**
 滑动停止后播放视频方法

 @param tableView tableview
 @param cellIndexPath 用来标记当前cell的indexpath
 @param playerView 播放View
 @return 返回当前正在播放的cell的indexpath
 */
- (NSIndexPath *)playVideoWhenTableViewStopScrollWithTableView:(UITableView *)tableView cellIndexPath:(NSIndexPath *)cellIndexPath playerView:(LZCustomPlayerView *)playerView playCountAddBlock:(void(^)(NSInteger totleCount))playCountBlock;


/**
 点击视频海报直接播放的方法

 @param cellIndexPath 相应海报所在的cell的indexpath
 @param playerView 播放View
 @return 返回当前正在播放的cell的indexpath
 */
- (NSIndexPath *)playVideoWhenClickVideoCoverImgWithIndexPath:(NSIndexPath *)cellIndexPath playerView:(LZCustomPlayerView *)playerView playCountAddBlock:(void(^)(NSInteger totleCount))playCountBlock;


/**
 滑动列表时,停止,并移除正在播放的视频

 @param tableView tableview
 @param cellIndexPath 当前播放的cell的标记,用来查找相应的cell视图
 */
- (void)removePlayViewWhenTableViewDidScrollWithTableView:(UITableView *)tableView cellIndexPath:(NSIndexPath *)cellIndexPath;


/**
 某些详情页直接播放方法

 @param bgView 父视图
 @param playerView 播放View
 @param videoUrl 地址
 */
- (void)playVideoWithBgView:(UIView *)bgView playerView:(LZCustomPlayerView *)playerView videoURL:(NSString *)videoUrl videoID:(NSString *)videoId playCountAddBlock:(void(^)(NSInteger totleCount))playCountBlock;

/**
 继续播放

 @param playerView <#playerView description#>
 */
- (NSIndexPath *)goOnPlayWithCellIndexPath:(NSIndexPath *)cellIndexPath playerView:(LZCustomPlayerView *)playerView tableView:(UITableView *)tableView playCountAddBlock:(void(^)(NSInteger totleCount))playCountBlock;


/**
 停止播放

 @param playerView <#playerView description#>
 */
- (void)stopPlayWithPlayerView:(LZCustomPlayerView *)playerView;

@end
